package com.sky.mapper;


import com.sky.entity.Employee;
import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDate;
import java.util.Map;

@Mapper
public interface UserMapper {
    /**
     * 根据用户名查询员工
     * @param openid
     * @return
     */
    @Select("select * from user where openid = #{openid}")
    User getByOpenid(String openid);

    /**
     * 新增用户信息
     */
    void insert(User user);
    @Select("select * from user where id =#{userId}")
    User getById(Long userId);

    /**
     * 统计当日新增用户
     * @param map
     * @return
     */
    @Select("select count(id) from user where create_time between #{begin} and #{end}")
    Integer sumByMap(Map map);

    /**
     * 统计总用户数
     * @return
     */
    @Select("select count(id) from user where create_time < #{end}")
    Integer countUser(Map map);

    /**
     * 统计订单数量
     * @param map
     * @return
     */
    Integer countByMap(Map map);
}
